/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package klient;

import Serializable.ParsedCmd;
import java.util.LinkedList;

/**
 *
 * @author Marcin
 */
public class Bridge {
    public static String errLabel="";
    public static ParsedCmd cmd=null;
    
    public static boolean buttonsEnabled=true;
    public static boolean connected=false;
    
    public static boolean readyToStart=false;
    
    public static boolean opPending=false;
    public static boolean succes=false;
    public static boolean needAny=false;
    
    public static boolean startGame=false;
    
    public static boolean isMulti=false;
    
    public static ParsedCmd ret=null;
    public static String players[] = new String[]{"---","---","---","---"};
    public static boolean ready[] = new boolean[]{false,false,false,false};
    public static boolean loaded[] = new boolean[]{false,false,false,false};
    
    public static LinkedList<ParsedCmd> toDo=new LinkedList<>();
    public static LinkedList<ParsedCmd> myReq=new LinkedList<>();
    
    public static int maxPlayers=4;//nie może być finalne ;pp
    
    public synchronized static ParsedCmd req(ParsedCmd pc){
        if(pc==null)
            return myReq.poll();
        else
            myReq.push(pc);
        return null;
    }
    public synchronized static ParsedCmd toDo(ParsedCmd pc){
        if(pc==null)
            return toDo.poll();
        else
            toDo.push(pc);
        return null;
    }
    
    public synchronized static void setCmd(ParsedCmd n){
        cmd=n;
    }
    public synchronized static void setErrLabel(String n){
        errLabel=n;
    }
    public synchronized static void setButtonsEnabled(boolean n){
        buttonsEnabled=n;
    }
    public synchronized static void setConnected(boolean n){
        connected=n;
    }
    public synchronized static void setOpPending(boolean n){
        opPending=n;
    }
    public synchronized static void setSucces(boolean n){
        succes=n;
    }
    public synchronized static void setNeedAny(boolean n){
        needAny=n;
    }
    public synchronized static void setRet(ParsedCmd n){
        ret=n;
    }
}
